<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>轮播</title>
    <script src="../jquery-3.1.1.js"></script>
    <style>
        ul,li{
            margin: 0;
            padding: 0;
            list-style: none;
        }
        .outer{
            width: 594px;
            height: 200px;
            border: 1px solid #ebeaea;
            margin: 0 auto;
            overflow: hidden;
        }
        .header ul,span,.button{
            float: left;
        }
        .header{
            height: 37px;
            background-image: url(../images/bg.png);    
        }
        .header .head{
            font-weight: bold;
            margin-left: 14px;
            display: inline-block;
            width: 87px;
            height: 37px;
            background-image: url(../images/bg.png);
            background-position: 0 -100px; 
            
        }
        .header .point{
            width: 44px;
            margin-left: 14px;
            margin-top: 14px;
        }
        .header .point li{
            float: left;
            width: 9px;
            height: 9px;
            border-radius: 50%;
            margin-left: 2px;
            background-image: url(../images/bg.png);
            background-position: 0 -320px;
           
        }
        .header .button{
            width: 60px;
            height: 22px;
            margin-left: 10px;
            margin-top: 7px;
            background-image: url(../images/bg.png);
            background-position: 0 24px;
        }
        .header .button:hover{
            background-position: 0 -401px;
        }
        .header .button span{
            width: 30px;
            height: 22px;
        }
        .content{
            width: 2400px;
        }
         .content .mov li{
            width: 600px;
            float: left;
            position: relative;
        }
        .outer .content .mov>li>div{
            float: left;
            margin-left: 18px;
            margin-top: 15px; 
        }
       .outer .header .active{
            background-image: url(../images/bg.png);
            background-position: 0 -219px;
        }
    </style>
</head>
<body>
    <div class="outer">
        <div class="header">
            <span class="head"></span>
            <ul class="point">
                <li class="active"></li>
                <li></li>
                <li></li>
                <li></li>
                <div style="clear: both"></div>
            </ul>
            <div class="button">
                <span class="pre"></span>
                <span class="next"></span>
            </div>
            
            <span style="float: right"><a href="jvascript:;">更多>></a></span>
            <div style="clear: both"></div>
        </div>
        <div class="content">
            <ul class="mov">
                <li>
                    <div>
                        <img src="../images/01.jpg" alt="">
                        <div><a href="javascript:;">海贼王</a></div>
                        <div><span>播放:</span><span>28,276</span></div>
                    </div>
                    <div>
                        <img src="../images/01.jpg" alt="">
                        <div><a href="javascript:;">海贼王</a></div>
                        <div><span>播放:</span><span>28,276</span></div>
                    </div>
                    <div>
                        <img src="../images/01.jpg" alt="">
                        <div><a href="javascript:;">海贼王</a></div>
                        <div><span>播放:</span><span>28,276</span></div>
                    </div>
                    <div>
                        <img src="../images/01.jpg" alt="">
                        <div><a href="javascript:;">海贼王</a></div>
                        <div><span>播放:</span><span>28,276</span></div>
                    </div>
                </li>
                <li>
                    <div>
                        <img src="../images/02.jpg" alt="">
                        <div><a href="javascript:;">哆啦A梦</a></div>
                        <div><span>播放:</span><span>33,326</span></div>
                    </div>
                    <div>
                        <img src="../images/02.jpg" alt="">
                        <div><a href="javascript:;">哆啦A梦</a></div>
                        <div><span>播放:</span><span>33,326</span></div>
                    </div>
                    <div>
                        <img src="../images/02.jpg" alt="">
                        <div><a href="javascript:;">哆啦A梦</a></div>
                        <div><span>播放:</span><span>33,326</span></div>
                    </div>
                    <div>
                        <img src="../images/02.jpg" alt="">
                        <div><a href="javascript:;">哆啦A梦</a></div>
                        <div><span>播放:</span><span>33,326</span></div>
                    </div>
                </li>
                <li>
                    <div>
                        <img src="../images/03.jpg" alt="">
                        <div><a href="javascript:;">火影忍者</a></div>
                        <div><span>播放:</span><span>28,276</span></div>
                    </div>
                    <div>
                        <img src="../images/03.jpg" alt="">
                        <div><a href="javascript:;">火影忍者</a></div>
                        <div><span>播放:</span><span>28,276</span></div>
                    </div>
                    <div>
                        <img src="../images/03.jpg" alt="">
                        <div><a href="javascript:;">火影忍者</a></div>
                        <div><span>播放:</span><span>28,276</span></div>
                    </div>
                    <div>
                        <img src="../images/03.jpg" alt="">
                        <div><a href="javascript:;">火影忍者</a></div>
                        <div><span>播放:</span><span>28,276</span></div>
                    </div> 
                </li>
                <li>
                    <div>
                        <img src="../images/04.jpg" alt="">
                        <div><a href="javascript:;">龙珠</a></div>
                        <div><span>播放:</span><span>28,276</span></div>
                    </div>
                    <div>
                        <img src="../images/04.jpg" alt="">
                        <div><a href="javascript:;">龙珠</a></div>
                        <div><span>播放:</span><span>28,276</span></div>
                    </div>
                    <div>
                        <img src="../images/04.jpg" alt="">
                        <div><a href="javascript:;">龙珠</a></div>
                        <div><span>播放:</span><span>28,276</span></div>
                    </div>
                    <div>
                        <img src="../images/04.jpg" alt="">
                        <div><a href="javascript:;">龙珠</a></div>
                        <div><span>播放:</span><span>28,276</span></div>
                    </div>
                </li>
            </ul>
        </div>
    </div>
</body>
</html>
<script>
    var index = 0;
    //后一页
    $('.button .next').click(function(){
        index = (index==$('.point li').length-1) ? 0 : (index+1);
        $('.point li').eq(index).addClass('active').siblings().removeClass('active');
        $('.mov li').animate({left:index*(-600)},800);
        
    });
    //前一页
    $('.pre').click(function(){
        index = index==0 ? $('.point li').length-1 : index-1; 
        $('.point li').eq(index).addClass('active').siblings().removeClass('active');
        // $('.mov li').eq(index).animate({left:index*(-600)},800).siblings().animate({left:index*(-600)},800);
        $('.mov li').animate({left:index*(-600)},800);
    });

</script>